const { app, BrowserWindow ,Menu} = require('electron')
const path = require('path')
function createWindow() {
  const mainWindow = new BrowserWindow({
    width: 1280,
    height: 770,
    minWidth:920,
    minHeight:600,
    maxWidth:1600,
    maxHeight:940,
    title: '《某高校学籍管理系统》--数据库第5组',
    webPreferences: {
      preload: path.join(__dirname, 'preload.js'),
      nodeIntegration: true,
      contextIsolation: false
    },
  })
  mainWindow.loadURL('http://localhost:8083')
  mainWindow.on('page-title-updated', (e) => {
    e.preventDefault()
  })
  Menu.setApplicationMenu(null);
  mainWindow.setIcon(path.join(__dirname, 'src/assets', 'electronLogo.ico'))
}
app.on('ready', createWindow)
app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') {
    app.quit()
  }
})
app.on('activate', () => {
  if (BrowserWindow.getAllWindows().length === 0) {
    createWindow()
  }
})

